package org.forum.service.impl;


import java.util.List;

import org.forum.dao.ReplyDao;
import org.forum.domain.Reply;
import org.forum.service.ReplyService;
import org.forum.utils.JsonUtil;
import org.json.JSONObject;

public class ReplyServiceImpl implements ReplyService{
	
	private ReplyDao replyDao;

	public void setReplyDao(ReplyDao replyDao) {
		this.replyDao = replyDao;
	}
	
	private JsonUtil jsonUtil;

	public void setJsonUtil(JsonUtil jsonUtil) {
		this.jsonUtil = jsonUtil;
	}

	@Override
	public void getReplyByViceTopicId(int viceTopicId) {
		List<Reply> replies = replyDao.getRepliesByMainTopicId(viceTopicId);
		JSONObject jsonObject = new JSONObject();
		jsonObject.put(Integer.toString(viceTopicId), replies);
		jsonUtil.outToJsonString(jsonObject.toString());
	}

}
